package com.vision.mapper;

import com.vision.pojo.entity.Tag;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface TagMapper {

    /**
     * 获取所有标签
     * @return 所有标签
     */
    @Select("select id,name from vs_tag")
    List<Tag> selectAllTag();

    /**
     * 根据视频 id 获取标签
     * @param videoId 视频 id
     * @return 标签列表
     */
    @Select("select t.id,t.name from vs_tag t left join vs_video_tag vt on t.id = vt.tag_id where vt.video_id = #{videoId}")
    List<Tag> selectTagByVideoId(Integer videoId);
}
